﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WarehouseWebAPP.code.BLL;
using System.Drawing;

namespace WarehouseWebAPP.Pages.user.Mail_Pages
{
    public partial class CustomerMail : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void SendButton_Click(object sender, EventArgs e)
        {
            SubjectTextBox.Enabled = false;
            BodyEditor.Enabled = false;
            MailToDropDownList.Enabled = false;
            SendButton.Enabled = false;
            CustomerBLL BLL = new CustomerBLL();
            string Address = BLL.CustomerGetByNum(new Guid(MailToDropDownList.SelectedValue))[0].customer_email;
            Boolean res = Mail.SendMail(Address, SubjectTextBox.Text, BodyEditor.Content);

            if (res == false)
            {
                SentLabel.Text = "Mail Failed";
                SentLabel.ForeColor = Color.Maroon;
            }
            SentLabel.Visible = true;
        }


    }
}
